/**
 * 
 */
package com.cxc.myweb.demo.service;

import java.util.List;

import com.cxc.myweb.demo.model.bpo.UserBpo;
import com.cxc.myweb.demo.model.dto.User;
import com.cxc.myweb.demo.util.JsonUtils;


/**
 * @author chenxiaocang
 *
 */
public class UserServiceImpl implements UserService {
	
	private UserBpo userBpo;
	
	public String sayHello(String name) {
		return "Hello,"+name;
	}

	public String queryUser(String userId) {
		User user = userBpo.queryUserByPk(Integer.parseInt(userId));
		return JsonUtils.toJSON(user);	
	}

	public String validateUser(String userName, String userPassword) {
		int ret = userBpo.validateUser(userName,userPassword);
		return JsonUtils.toJSON(ret);
	}

	public String queryUserList() {
		List<User> userList = userBpo.queryUsers(null);
		return JsonUtils.toJSON(userList);
	}

	/**
	 * @param userBpo the userBpo to set
	 */
	public void setUserBpo(UserBpo userBpo) {
		this.userBpo = userBpo;
	}
		   
}
